*Settings-----------------------------------------------------------------------
set scheme plotplain
set more off
clear
program drop _all


*Define Globals-----------------------------------------------------------------
global machine	"[ADD THE ABSOLUTE PATH TO THE REPLICATION FOLDER]/data_replication/"

global sdir "${machine}/data/source/"

*Create directory structure-----------------------------------------------------
shell rmdir "temp" /q /s
mkdir "temp"
shell rmdir "tables" /q /s
mkdir "tables"
shell rmdir "figures" /q /s
mkdir "figures"


*Define functions---------------------------------------------------------------


*-------------------------------------------------------------------------------

*=================================================================*
*---Attrition Checks----------------------------------------------*
*Creates table A1
*=================================================================*
do "1_owner_attrition.do"

*=================================================================*
*---Demand Curves-------------------------------------------------*
*Creates Figures 1a-1d and A6a-A6d
*=================================================================*
do "2_demand_curves.do"
do "2b_demand_curves_qqplot.do"

*=================================================================*
*---WTP Heterogeneity---------------------------------------------*
*Creates table A3
*=================================================================*
do "3_wtp_heterogeneity.do"

*=================================================================*
*---Predict Standard Characteristics------------------------------*
*Creates table A4
*=================================================================*
do "4_predictions_standard.do"

*=================================================================*
*---Treatment Effects on Predictions------------------------------*
*Creates Table 1
*=================================================================*
do "5_predictions_treatment_effects.do"

*=================================================================*
*---Predictions Across Owners-------------------------------------*
*Creates Table 2
*=================================================================*
do "6_predictions_wtp.do"

*=================================================================*
*---Stakes group overprediction heterogeneity---------------------*
*Creates Table A5
*=================================================================*
do "7_predictions_wtp_heterogeneity.do"

*=================================================================*
*---Horse race with observables-----------------------------------*
*Creates Table A6
*=================================================================*
do "8_predictions_wtp_observables.do"

*=================================================================*
*---Descriptive statistics----------------------------------------*
*Creates Table A2
*=================================================================*
do "9_owner_leader_descript.do"

*=================================================================*
*---Policy Counterfactuals----------------------------------------*
*Creates Table 3
*=================================================================*
do "10_policy_counterfactuals.do"

*NB: this last code file preps and excel spreadsheet to be run in python,
*    the python code that creates Table 3 is "10x_policy_counterfactuals.py" 
*    and must be run separately in python with libraries: pandas, numpy, and time


*End------
clear
graph close
shell rmdir "temp" /q /s





